#!/usr/bin/env python
# coding=utf-8
# __author__ = 'Yunchao Ling'

id = ""
title = ""
medabbr = ""
issn_print = ""
issn_online = ""
isoabbr = ""
nlmid = ""

infile = open("J_Entrez", "r")

print("JrId\tJournalTitle\tMedAbbr\tISSN(Print)\tISSN(Online)\tIsoAbbr\tNlmId")

for line in infile:
    line = line.rstrip()
    if line.startswith("-----"):
        id = ""
        title = ""
        medabbr = ""
        issn_print = ""
        issn_online = ""
        isoabbr = ""
        nlmid = ""
    elif line.startswith("JrId"):
        id = line[6:]
    elif line.startswith("JournalTitle"):
        title = line[14:]
    elif line.startswith("MedAbbr"):
        medabbr = line[9:]
    elif line.startswith("ISSN (Print)"):
        issn_print = line[14:]
    elif line.startswith("ISSN (Online)"):
        issn_online = line[15:]
    elif line.startswith("IsoAbbr"):
        isoabbr = line[9:]
    elif line.startswith("NlmId"):
        nlmid = line[7:]
        print(
        id + "\t" + title + "\t" + medabbr + "\t" + issn_print + "\t" + issn_online + "\t" + isoabbr + "\t" + nlmid)
infile.close()